import { EnergyMgr } from '../component/EnergyMgr';
cc.Class({
    extends: require('BasePanel'),

    properties: {

    },

    onLoad() {
        this._super();
    },

    onEnter(args, action = true) {
        this._super(args, action);
    },

    onExit(args) {
        this._super(args);
    },

    buttonListener(button) {
        let name = button.node.name;
        if (name == 'btnClose') {
            this._onClose();
        } else if (name == 'btnShare') {
            G.partner.sendEvent('分享', { '类型': 'addEnergy' });
            G.partner.share({ title: '测测你的智商达标没！' },()=>{
                let result = EnergyMgr.addEnergy();
                if(result){
                    G.game.toast('增加1点能量', 0.6);
                }
                this._onClose();
            });
        } else if (name == 'btnAd') {
            G.game.toast('广告暂未开启', 0.6);
        }

    },
    // _onTouchStart() {
    // },

});
